home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Video Toaster 4.0
/
Video Toaster v4.0.iso
/
arexx
/
modeler
/
spherize.lwm
< prev
next >
Wrap
Text File
|
1993-12-13
|
1KB
|
70 lines
/* CMD: Spherize
* Spherize data points -- Modeler ARexx transform.
*/
/* Sun Jan 31 21:10:22 1993 */
address "LWModelerARexx.port"
libadd = addlib("LWModelerARexx.port",0)
signal on error
signal on syntax
MATHLIB="rexxmathlib.library"
IF POS(MATHLIB , SHOW('L')) = 0 THEN
IF ~ADDLIB(MATHLIB , 0 , -30 , 0) THEN DO
call notify(1,"!Can't find "MATHLIB)
exit
END
/* -- Main code body -- */
/* Get center and radius of inflation.
*/
call req_begin "Spherize"
id_rad = req_addcontrol("Radius", 'n', 1)
id_cen = req_addcontrol("Center", 'v', 1)
call req_setval id_rad, 1.0, 1.0
if (~req_post()) then exit
rad = req_getval(id_rad)
parse value req_getval(id_cen) with cx cy cz .
call req_end
/* Transform loop
*/
n = xfrm_begin()
call meter_begin n, "Spherize"
do i = 1 to n
parse value xfrm_getpos(i) with x y z .
dx = x - cx
dy = y - cy
dz = z - cz
d = sqrt(dx * dx + dy * dy + dz * dz)
if (d ~= 0) then do
d = rad / d
x = cx + dx * d
y = cy + dy * d
z = cz + dz * d
call xfrm_setpos i, x y z
end
call meter_step
end
call meter_end
call xfrm_end
/* -- End Main code -- */
if (libadd) then call remlib("LWModelerARexx.port")
exit
syntax:
error:
call end_all
t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
if (libadd) then call remlib("LWModelerARexx.port")
exit